from django.contrib import admin
from django.conf.urls import url
from . import views
from rest_framework.routers import DefaultRouter

urlpatterns = [
    url(r'^categories/(?P<pk>\d+)/$', views.CategorieView.as_view()),
    url(r'^categories/(?P<pk>\d+)/skus/$', views.GoodsView.as_view()),
    url(r'^browse_histories/$', views.GoodHistoryView.as_view()),
]

# 通过REST framework的router来定义路由
router = DefaultRouter()

# 路径匹配
router.register('skus/search', views.SKUSearchViewSet, base_name='skus_search')
# 添加到urls路由中
urlpatterns += router.urls
